﻿#region Software License
/**************************************************************/
/*          Business of Software Consulting                   */
/*          FREE SOFTWARE LICENSE                             */
/**************************************************************/
/*  Directory Manifest Generator                              */
/*  by: Mike Cating                                           */
/*  © 2009 Business of Software Consulting                    */
/*                                                            */
/* BUSINESS OF SOFTWARE CONSULTING DISCLAIMS ALL WARRANTIES,  */
/* RESPONSIBILITIES, AND LIABILITIES ASSOCIATED WITH          */
/* USE OF THIS CODE IN ANY WAY, SHAPE, OR FORM                */
/* REGARDLESS HOW IMPLICIT, EXPLICIT, OR OBSCURE IT           */
/* IS. IF THERE IS ANYTHING QUESTIONABLE WITH REGARDS         */
/* TO THIS SOFTWARE BREAKING AND YOU GAIN A LOSS OF           */
/* ANY NATURE, WE ARE NOT THE RESPONSIBLE PARTY. USE          */
/* OF THIS SOFTWARE CREATES ACCEPTANCE OF THESE TERMS         */
/*                                                            */
/* USE OF THIS CODE MUST RETAIN ALL COPYRIGHT NOTICES         */
/* AND LICENSES (MEANING THIS TEXT).                          */
/*                                                            */
/**************************************************************/
#endregion


using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.IO;

namespace BOSTools.DirectoryManifestGenerator
{
    public class FileDetail
    {
        private string _relativeDirectory;
        private string _fileName;
        private Int64 _fileLengthBytes;
        private DateTime _dateCreated;
        private DateTime _dateModified;
        private VersionInfo _productVersion;
        private VersionInfo _fileVersion;
        private string _checksum;

        [XmlAttribute("relativedirectory")]
        public string RelativeDirectory
        {
            get { return _relativeDirectory; }
            set { _relativeDirectory = value; }
        }

        [XmlAttribute("filename")]
        public string FileName
        {
            get { return _fileName; }
            set { _fileName = value; }
        }

        [XmlIgnore]
        public string RelativeFileName
        {
            get { return Path.Combine(_relativeDirectory, _fileName); }
            set
            {
                _relativeDirectory = Path.GetDirectoryName(value);
                _fileName = Path.GetFileName(value);
            }
        }

        [XmlAttribute("filelengthbytes")]
        public Int64 FileLengthBytes
        {
            get { return _fileLengthBytes; }
            set { _fileLengthBytes = value; }
        }

        [XmlAttribute("creationdate")]
        public DateTime DateCreated
        {
            get { return _dateCreated; }
            set { _dateCreated = value; }
        }

        [XmlAttribute("modificationdate")]
        public DateTime DateModified
        {
            get { return _dateModified; }
            set { _dateModified = value; }
        }

        public VersionInfo ProductVersion
        {
            get { return _productVersion; }
            set { _productVersion = value; }
        }

        public VersionInfo FileVersion
        {
            get { return _fileVersion; }
            set { _fileVersion = value; }
        }

        [XmlAttribute("checksum")]
        public string Checksum
        {
            get { return _checksum; }
            set { _checksum = value; }
        }
    }
}
